/*
 * Valentine Gladstein
 * SOLAR ID 108731583
 * Homework #5
 * CSE214
 * Recitation 03-Phil Ammirato
 * Grading TA: Yanjie Li
 */

import java.io.*;
import java.util.*;

public class TreeNode {

    private TreeNode[] childrenArray;
    private int numChildren;

    private String label;
    private String message;
    private String prompt;

    public TreeNode(String l, String p, String m) {
	label = l;
	message = m;
	prompt = p;

	childrenArray = new TreeNode[9];
	numChildren = 0;
    }

    public TreeNode getChild(int i) {
	return childrenArray[i];
    }

    public void setChild(TreeNode node, int i) {
	childrenArray[i] = node;
	numChildren++;
    }

    public boolean addChild(TreeNode childNode) {
	if (numChildren == 9)
	    return false;
	childrenArray[numChildren] = childNode;
	numChildren++;
	return true;
    }

    public int numChildren() {
	return numChildren;
    }


    public void setLabel(String input) {
	label = input;
    }

    public void setMessage(String input) {
	message = input;
    }

    public void setPrompt(String input) {
	prompt = input;
    }

    public String getLabel() {
	return label;
    }

    public String getMessage() {
	return message;
    }

    public String getPrompt() {
	return prompt;
    }

    public boolean isLeaf() {
	return (numChildren == 0);
    }

}
